<template>
  <el-dialog width="400px" title="方案名称" :visible.sync="params.visible">
    <el-form ref="form" label-width="80px">
      <el-form-item label="方案名称:" label-width="80px">
        <el-input v-model="formData.name" />
      </el-form-item>
      <el-form-item>
        <el-checkbox v-model="note">短信</el-checkbox>
        <el-checkbox v-model="webChar">微信</el-checkbox>
      </el-form-item>
    </el-form>
    <dialog-btn slot="footer" />
  </el-dialog>
</template>
<script>
import { addTargertConfig } from '@/api/system'
import { ParamArr } from '@/../public/js/paramarr'
export default {
  name: 'ShowPlanConfigNameLayer',
  props: {
    params: {
      type: Object,
      default: null
    }
  },
  data() {
    return {
      formData: {
        name: ''
      },
      webChar: true,
      note: true
    }
  },
  created() {
    this.webChar = true
    this.note = true
  },
  methods: {
    confirm() {
      var vPar = new ParamArr()
      vPar.setStr('Name', this.formData.name)
      addTargertConfig(vPar).then((vPar) => {
        this.params.confirm({
          sNames: this.formData.name,
          isMsg: !this.note,
          isWeChat: !this.webChar
        })
      })
    }
  }
}
</script>
